package com.fulihui.usercore.common.integration.impl;


import com.fulihui.systemcore.api.WechatConfigService;
import com.fulihui.systemcore.condition.WechatConfigCondition;
import com.fulihui.systemcore.dto.WechatConfig;
import com.fulihui.usercore.common.integration.WechatConfigServiceClient;
import org.apache.dubbo.config.annotation.Reference;
import org.near.servicesupport.request.RequestBuilder;
import org.near.servicesupport.result.TSingleResult;
import org.near.servicesupport.util.ServiceResultUtil;
import org.springframework.stereotype.Component;

/**
 * @see WechatConfigServiceClient
 * @author Willard.Hu on 2016/8/18.
 */
@Component
public class WechatConfigServiceClientImpl implements WechatConfigServiceClient {
    @Reference(version = "1.0.0", check = false)
    private WechatConfigService wechatConfigService;

    /**
     * @see WechatConfigServiceClient#querySingle(WechatConfigCondition)
     */
    @Override
    public WechatConfig querySingle(WechatConfigCondition condition) {
        TSingleResult<WechatConfig> result = wechatConfigService.querySingle(RequestBuilder
            .buildT(condition));
        ServiceResultUtil.checkResult(result);
        return result.getValue();
    }
}
